#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t; cin >> t;
	while (t--) {
		int n; cin >> n;
		ll ans = 0;
		for (int i = 0; i < n; i++) {
			int x; cin >> x;
			ans ^= x;
		}
		cout << ans << '\n';
	}
	return 0;
}